﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AliyunOpenSearch4Net.Base;
using Newtonsoft.Json;

namespace AliyunOpenSearch4Net.Error
{
    class ErrorListRequest : RequestBase<Response<ErrorListResult>>
    {
        public ErrorListRequest()
            : base(string.Empty)
        {

        }

        public int Page { get; set; }

        public int PageSize { get; set; }

        public SortMode SortMode { get; set; }

        protected override void RegisterQueryItems(IList<KeyValuePair<string, string>> list)
        {
            list.Add("page", Page.ToString());
            list.Add("page_size", PageSize.ToString());
            list.Add("sort_mode", SortMode.ToString());
        }
    }

    /// <summary>
    /// Error list result
    /// </summary>
    public class ErrorListResult
    {
        /// <summary>
        /// Gets or sets the page index.
        /// </summary>
        /// <value>
        /// The page.
        /// </value>
        [JsonProperty("page")]
        public int Page { get; set; }

        /// <summary>
        /// Gets or sets the size of the page.
        /// </summary>
        /// <value>
        /// The size of the page.
        /// </value>
        [JsonProperty("page_size")]
        public int PageSize { get; set; }

        /// <summary>
        /// Gets or sets the count.
        /// </summary>
        /// <value>
        /// The count.
        /// </value>
        [JsonProperty("count")]
        public int Count { get; set; }

        /// <summary>
        /// Gets or sets the errors.
        /// </summary>
        /// <value>
        /// The items.
        /// </value>
        [JsonProperty("items")]
        public string[] Items { get; set; }
    }
}
